package com.longxi.tianjintianbao.ui.activity.complaint;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.complaint.SaveComplaintAtPresenter;
import com.longxi.tianjintianbao.ui.view.complaint.ISaveComplaintAtView;

import butterknife.BindView;

/**
 * Created by 70339 on 2018/5/3.
 * 代码无八阿哥
 * 阿弥陀佛
 */
public class SaveComplaintActivity extends BaseActivity<ISaveComplaintAtView, SaveComplaintAtPresenter> implements ISaveComplaintAtView {

    @BindView(R.id.etContent)
    EditText mEtContent;
    @BindView(R.id.rgDealType)
    RadioGroup mRgDealType;
    @BindView(R.id.rBtnPhone)
    RadioButton mRBtnPhone;
    @BindView(R.id.rBtnComeOn)
    RadioButton mRBtnComeOn;
    @BindView(R.id.recyclerView)
    RecyclerView mRecyclerView;
    @BindView(R.id.btnLogin)
    TextView mBtnLogin;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_save_complain;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
    }

    @Override
    public void initListener() {
        super.initListener();
        mPresenter.initSelectImage(getRecyclerView(), 2);
        mBtnLogin.setOnClickListener(v -> mPresenter.acceptTask());
        mRgDealType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                mPresenter.getDealType(i);
            }
        });
    }

    @Override
    protected SaveComplaintAtPresenter createPresenter() {
        return new SaveComplaintAtPresenter(this);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        mPresenter.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public EditText getEtContent() {
        return mEtContent;
    }

    @Override
    public RadioGroup getRgDealType() {
        return mRgDealType;
    }

    @Override
    public RadioButton getRBtnPhone() {
        return mRBtnPhone;
    }

    @Override
    public RadioButton getRBtnComeOn() {
        return mRBtnComeOn;
    }

    @Override
    public RecyclerView getRecyclerView() {
        return mRecyclerView;
    }

    @Override
    public TextView getBtnLogin() {
        return mBtnLogin;
    }
}
